<div class="control-group form-horizontal" style="margin: 0 0 0 0;">
    <div class="row row-hover recommend-element">
        <div class="span4">
            <label class="control-label-small">可见性</label>
            <p class="controls-text-small icd-element-relation-type" >一般特殊关系</p>
        </div>
        <div class="span1-compact" style="display: none">
            <span class="add-on remove-input" ><i class="icon-edit"></i></span>
            <span class="add-on remove-input" style="margin-left: 2px" ><i class="icon-trash"></i></span>
        </div>
    </div>
    <div class="control-sub" style="display:none;">
        <label class="control-label-small" >可见性</label>
        <div  class="controls-small icd-element-input">
            <label class="radio inline">
                <input type="radio" name="optionsRadios"  value="Public" checked>
                Public
            </label>
            <label class="radio inline">
                <input type="radio" name="optionsRadios"  value="Protected">
                Protected
            </label>
            <label class="radio inline">
                <input type="radio" name="optionsRadios"  value="Private">
                Private
            </label>
            <div class="btn-group">
                <a href="javascript:;" class="btn btn-primary icd-element-input-visibility-submit">确定</a>
                <a href="javascript:;" class="btn icd-element-input-visibility-cancel">取消</a>
            </div>
        </div>

    </div>
</div>

<script>
    $(function(){
        $(".icd-element-input-relation-type-submit").live("click",function(){
            var checked_val = $(this).parent().parent().children("label").children("input[type='radio']:checked").val();
            $(this).parent().parent().parent().children(".row").children(".span4").children("p").text(checked_val);

            $(this).parent().parent().hide();
            $(this).parent().parent().parent().children(".row").show();
            mutex_input_dblclick=0;
            var url='/post/html/icd-element-visibility/';
            if(checked_val === '公共')    url=url+'public';
            if(checked_val === '保护')    url=url+'protected';
            if(checked_val === '私有')    url=url+'private';
            if(checked_val === '缺省')    url=url+'none';

            $.ajax({
                url: url,
                type: 'post',
                data: {},
                success: function(html)
                {
                    //$("#icd-relation-detail").children().remove();
                    //$("#icd-relation-detail").append(html);
                }
            });

        });

        $(".icd-element-input-relation-type-cancel").live("click",function(){
            var checked_val = $(this).parent().parent().parent().children("p").text();
            $(this).parent().parent().children("label").children("input[type='radio'][value="+checked_val+"]").attr("checked",true);

            $(this).parent().parent().hide();
            $(this).parent().parent().parent().children("p").show();
            mutex_input_dblclick=0;
        });


    });
</script>